package server

import (
    "github.com/go-kratos/kratos/contrib/registry/consul/v2"
    "github.com/go-kratos/kratos/v2/registry"
    "github.com/hashicorp/consul/api"
    "mall/app/product/internal/conf"
)

func NewRegistrar(conf *conf.Registry) registry.Registrar {
    c := api.DefaultConfig()
    c.Address = conf.Consul.Address
    c.Scheme = conf.Consul.Scheme
    client, err := api.NewClient(c)
    if err != nil {
        panic(err)
    }
    return consul.New(client, consul.WithHealthCheck(false))
}
